package model

import (
	"time"

	"gorm.io/plugin/soft_delete"
)

type DemoOrder struct {
	Id        int64  `gorm:"column:id;primary_key" json:"id"`
	UserId    int64  `gorm:"column:user_id" json:"user_id"`
	BillMoney int64  `gorm:"column:bill_money" json:"bill_money"` // 订单金额（分）
	OrderNo   string `gorm:"column:order_no" json:"order_no"`     // 订单号
	// OrderGoodsId int64                 `gorm:"column:order_goods_id" json:"order_goods_id"`
	State     int8                  `gorm:"column:state;default:1" json:"state"` // 1-待支付，2-支付成功，3-支付失败
	PaidAt    time.Time             `gorm:"column:paid_at;default:\"1970-01-01 00:00:00\"" json:"paid_at"`
	IsDel     soft_delete.DeletedAt `gorm:"softDelete:flag" json:"is_del"`
	CreatedAt time.Time             `gorm:"column:created_at" json:"created_at"`
	UpdatedAt time.Time             `json:"updatedAt" gorm:"column:update_at;;default:\"CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP\""`
}

func (DemoOrder) TableName() string {
	return "demo_orders"
}
